﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SmartMD.Manager.Common
{
    /// <summary>
    /// Interaction logic for ToolBar.xaml
    /// </summary>
    /// 
    //定义委托，它定义了可以代表的方法的类型
    public delegate void OperateDelegate();

    public partial class ToolBar : BaseWindow
    {
        public OperateDelegate newHandler = null;
        public OperateDelegate deleteHandler = null;
        public OperateDelegate saveHandler = null;
        public OperateDelegate editHandler = null;
             
        public ToolBar()
        {
            InitializeComponent();
        }

        private void btnNew_Click(object sender, RoutedEventArgs e)
        {
            if (newHandler != null)
                newHandler();
        }

        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (deleteHandler != null)
                deleteHandler();
        }

        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (saveHandler != null)
                saveHandler();
        }

        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (editHandler != null)
                editHandler();
        }

    }
}
